1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module adw.WindowTitle; 26 27 private import adw.c.functions; 28 public import adw.c.types; 29 private import glib.ConstructionException; 30 private import glib.Str; 31 private import glib.c.functions; 32 private import gobject.ObjectG; 33 private import gtk.AccessibleIF; 34 private import gtk.AccessibleT; 35 private import gtk.BuildableIF; 36 private import gtk.BuildableT; 37 private import gtk.ConstraintTargetIF; 38 private import gtk.ConstraintTargetT; 39 private import gtk.Widget; 40 41 42 /** 43 * A helper widget for setting a window's title and subtitle. 44 * 45 * <picture> 46 * <source srcset="window-title-dark.png" media="(prefers-color-scheme: dark)"> 47 * <img src="window-title.png" alt="window-title"> 48 * </picture> 49 * 50 * `AdwWindowTitle` shows a title and subtitle. It's intended to be used as the 51 * title child of [class@Gtk.HeaderBar] or [class@HeaderBar]. 52 * 53 * ## CSS nodes 54 * 55 * `AdwWindowTitle` has a single CSS node with name `windowtitle`. 56 * 57 * Since: 1.0 58 */ 59 public class WindowTitle : Widget 60 { 61 /** the main Gtk struct */ 62 protected AdwWindowTitle* adwWindowTitle; 63 64 /** Get the main Gtk struct */ 65 public AdwWindowTitle* getWindowTitleStruct(bool transferOwnership = false) 66 { 67 if (transferOwnership) 68 ownedRef = false; 69 return adwWindowTitle; 70 } 71 72 /** the main Gtk struct as a void* */ 73 protected override void* getStruct() 74 { 75 return cast(void*)adwWindowTitle; 76 } 77 78 /** 79 * Sets our main struct and passes it to the parent class. 80 */ 81 public this (AdwWindowTitle* adwWindowTitle, bool ownedRef = false) 82 { 83 this.adwWindowTitle = adwWindowTitle; 84 super(cast(GtkWidget*)adwWindowTitle, ownedRef); 85 } 86 87 88 /** */ 89 public static GType getType() 90 { 91 return adw_window_title_get_type(); 92 } 93 94 /** 95 * Creates a new `AdwWindowTitle`. 96 * 97 * Params: 98 * title = a title 99 * subtitle = a subtitle 100 * 101 * Returns: the newly created `AdwWindowTitle` 102 * 103 * Since: 1.0 104 * 105 * Throws: ConstructionException GTK+ fails to create the object. 106 */ 107 public this(string title, string subtitle) 108 { 109 auto __p = adw_window_title_new(Str.toStringz(title), Str.toStringz(subtitle)); 110 111 if(__p is null) 112 { 113 throw new ConstructionException("null returned by new"); 114 } 115 116 this(cast(AdwWindowTitle*) __p); 117 } 118 119 /** 120 * Gets the subtitle of @self. 121 * 122 * Returns: the subtitle 123 * 124 * Since: 1.0 125 */ 126 public string getSubtitle() 127 { 128 return Str.toString(adw_window_title_get_subtitle(adwWindowTitle)); 129 } 130 131 /** 132 * Gets the title of @self. 133 * 134 * Returns: the title 135 * 136 * Since: 1.0 137 */ 138 public string getTitle() 139 { 140 return Str.toString(adw_window_title_get_title(adwWindowTitle)); 141 } 142 143 /** 144 * Sets the subtitle of @self. 145 * 146 * Params: 147 * subtitle = a subtitle 148 * 149 * Since: 1.0 150 */ 151 public void setSubtitle(string subtitle) 152 { 153 adw_window_title_set_subtitle(adwWindowTitle, Str.toStringz(subtitle)); 154 } 155 156 /** 157 * Sets the title of @self. 158 * 159 * Params: 160 * title = a title 161 * 162 * Since: 1.0 163 */ 164 public void setTitle(string title) 165 { 166 adw_window_title_set_title(adwWindowTitle, Str.toStringz(title)); 167 } 168 }